// 文件路径: com.city.java.reports.controller.ReportProcessingController.java
package com.city.java.reports.controller;

import com.city.java.reports.pojo.entity.ReportProcessing;
import com.city.java.reports.service.ReportProcessingService;
import com.city.java.base.response.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 举报处理控制器
 * RestController注解: 组合注解，相当于@Controller + @ResponseBody
 * Api注解: Knife4j文档中模块的显示名称
 * RequestMapping注解: 设置统一的请求路径前缀
 */
@Slf4j
@Api(tags = "08.举报处理模块")
@RestController
@RequestMapping("/api/reports/processing")
public class ReportProcessingController {

    @Autowired
    private ReportProcessingService reportProcessingService;

    /**
     * 添加举报处理记录
     * PostMapping注解: 处理POST请求
     * ApiOperation注解: Knife4j文档中接口的显示名称
     */
    @PostMapping("/add")
    @ApiOperation(value = "添加举报处理记录", notes = "添加新的举报处理信息")
    public JsonResult addReportProcessing(
            @ApiParam(value = "举报处理信息", required = true)
            @RequestBody ReportProcessing reportProcessing) {
        log.info("接收到添加举报处理记录请求: {}", reportProcessing);
        return reportProcessingService.addReportProcessing(reportProcessing);
    }

    /**
     * 根据处理ID查询举报处理记录
     * GetMapping注解: 处理GET请求
     * PathVariable注解: 获取路径中的参数
     */
    @GetMapping("/select/id/{processingId}")
    @ApiOperation(value = "根据ID查询举报处理记录", notes = "根据处理ID查询举报处理详细信息")
    public JsonResult getReportProcessingById(
            @ApiParam(value = "处理ID", required = true, example = "1")
            @PathVariable Long processingId) {
        log.info("接收到根据ID查询举报处理记录请求: ID={}", processingId);
        return reportProcessingService.getReportProcessingById(processingId);
    }

    /**
     * 根据举报ID查询举报处理记录
     */
    @GetMapping("/select/report/{reportId}")
    @ApiOperation(value = "根据举报ID查询处理记录", notes = "根据举报ID查询处理记录")
    public JsonResult getReportProcessingByReportId(
            @ApiParam(value = "举报ID", required = true, example = "1")
            @PathVariable Long reportId) {
        log.info("接收到根据举报ID查询处理记录请求: reportId={}", reportId);
        return reportProcessingService.getReportProcessingByReportId(reportId);
    }

    /**
     * 根据状态查询举报处理列表
     */
    @GetMapping("/select/{status}")
    @ApiOperation(value = "根据状态查询举报处理记录", notes = "根据状态查询举报处理列表")
    public JsonResult getReportProcessingsByStatus(
            @ApiParam(value = "状态", required = true, example = "PENDING")
            @PathVariable ReportProcessing.ProcessingStatus status) {
        log.info("接收到根据状态查询举报处理记录请求: status={}", status);
        return reportProcessingService.getReportProcessingsByStatus(status);
    }

    /**
     * 查询所有举报处理列表
     */
    @GetMapping("/quarry")
    @ApiOperation(value = "查询所有举报处理记录", notes = "查询所有举报处理列表")
    public JsonResult getAllReportProcessings() {
        log.info("接收到查询所有举报处理记录请求");
        return reportProcessingService.getAllReportProcessings();
    }

    /**
     * 根据处理ID删除举报处理记录
     * DeleteMapping注解: 处理DELETE请求
     */
    @DeleteMapping("/delete/id/{processingId}")
    @ApiOperation(value = "根据ID删除举报处理记录", notes = "根据处理ID删除举报处理记录")
    public JsonResult deleteReportProcessingById(
            @ApiParam(value = "处理ID", required = true, example = "1")
            @PathVariable Long processingId) {
        log.info("接收到根据ID删除举报处理记录请求: ID={}", processingId);
        return reportProcessingService.deleteReportProcessingById(processingId);
    }

    /**
     * 更新举报处理信息
     * PutMapping注解: 处理PUT请求
     */
    @PutMapping("/update")
    @ApiOperation(value = "更新举报处理信息", notes = "更新举报处理详细信息")
    public JsonResult updateReportProcessing(
            @ApiParam(value = "举报处理信息", required = true)
            @RequestBody ReportProcessing reportProcessing) {
        log.info("接收到更新举报处理信息请求: {}", reportProcessing);
        return reportProcessingService.updateReportProcessing(reportProcessing);
    }
}
